Skip to content

Close session save handler after encoding failures - #224

Open
iliaal wants to merge 1 commit into
masterfrom
fix/session-encode-null-still-close
Open

Close session save handler after encoding failures#224
iliaal wants to merge 1 commit into
masterfrom
fix/session-encode-null-still-close

Conversation

@iliaal

@iliaal iliaal commented Aug 5, 2026

Copy link
Copy Markdown
Owner

php_session_save_current_state() skipped s_close() when encoding returned NULL. It also could not invoke a user close handler while an encoding exception was pending. Continue cleanup after either failure, protecting and restoring or chaining the pending exception around the close callback. This prevents the save handler and file lock from remaining open and avoids a redundant generic write-failure warning.

@iliaal
iliaal force-pushed the fix/session-encode-null-still-close branch 3 times, most recently from 85dd04f to 062990c Compare August 5, 2026 04:22
php_session_save_current_state() returned before s_close() when session
encoding returned NULL. It also could not invoke a user close handler while
an encoding exception was pending. Either path could leave a save handler
and file lock open.

Continue to s_close() after encoding failures. Protect pending encoding
exceptions while invoking the close handler, then restore or chain them
after cleanup. Avoid the redundant generic write-failure warning when
encoding already reported the failure.
@iliaal
iliaal force-pushed the fix/session-encode-null-still-close branch from 062990c to 9143dfb Compare August 5, 2026 12:30
@iliaal iliaal changed the title Close session save handler after encode failure Close session save handler after encoding failures Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant